<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qtextformat.cpp -->
  <title>QTextListFormat Class | Qt GUI 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QTextListFormat</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QTextListFormat Class</h1>
<!-- $$$QTextListFormat-brief -->
<p>The QTextListFormat class provides formatting information for lists in a <a href="qtextdocument.html">QTextDocument</a>. <a href="#details">More...</a></p>
<!-- @@@QTextListFormat -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QTextListFormat&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qtextformat.html">QTextFormat</a></td></tr></table></div><ul>
<li><a href="qtextlistformat-members.html">List of all members, including inherited members</a></li>
</ul>
<p><b>Note:</b> All functions in this class are <a href="../qtdoc/threads-reentrancy.html">reentrant</a>.</p>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#Style-enum">Style</a></b> { ListDisc, ListCircle, ListSquare, ListDecimal, ListLowerAlpha, &hellip;, ListUpperRoman }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#QTextListFormat">QTextListFormat</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#indent">indent</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#numberPrefix">numberPrefix</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#numberSuffix">numberSuffix</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#setIndent">setIndent</a></b>(int <i>indentation</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#setNumberPrefix">setNumberPrefix</a></b>(const QString &amp;<i>numberPrefix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#setNumberSuffix">setNumberSuffix</a></b>(const QString &amp;<i>numberSuffix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#setStyle">setStyle</a></b>(QTextListFormat::Style <i>style</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTextListFormat::Style </td><td class="memItemRight bottomAlign"><b><a href="qtextlistformat.html#style">style</a></b>() const</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QTextListFormat-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>A list is composed of one or more items, represented as text blocks. The list's format specifies the appearance of items in the list. In particular, it determines the indentation and the style of each item.</p>
<p>The indentation of the items is an integer value that causes each item to be offset from the left margin by a certain amount. This value is read with <a href="qtextlistformat.html#indent">indent</a>() and set with <a href="qtextlistformat.html#setIndent">setIndent</a>().</p>
<p>The style used to decorate each item is set with <a href="qtextlistformat.html#setStyle">setStyle</a>() and can be read with the <a href="qtextlistformat.html#style">style</a>() function. The style controls the type of bullet points and numbering scheme used for items in the list. Note that lists that use the decimal numbering scheme begin counting at 1 rather than 0.</p>
<p>Style properties can be set to further configure the appearance of list items; for example, the <a href="qtextformat.html#Property-enum">ListNumberPrefix</a> and <a href="qtextformat.html#Property-enum">ListNumberSuffix</a> properties can be used to customize the numbers used in an ordered list so that they appear as (1), (2), (3), etc.:</p>
<pre class="cpp">

  <span class="type"><a href="qtextlistformat.html#QTextListFormat">QTextListFormat</a></span> listFormat;

  listFormat<span class="operator">.</span>setStyle(<span class="type"><a href="qtextlistformat.html#QTextListFormat">QTextListFormat</a></span><span class="operator">::</span>ListDecimal);
  listFormat<span class="operator">.</span>setNumberPrefix(<span class="string">&quot;(&quot;</span>);
  listFormat<span class="operator">.</span>setNumberSuffix(<span class="string">&quot;)&quot;</span>);

  cursor<span class="operator">.</span>insertList(listFormat);

</pre>
</div>
<p><b>See also </b><a href="qtextlist.html">QTextList</a>.</p>
<!-- @@@QTextListFormat -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Style$$$ListDisc$$$ListCircle$$$ListSquare$$$ListDecimal$$$ListLowerAlpha$$$ListUpperAlpha$$$ListLowerRoman$$$ListUpperRoman$$$ListStyleUndefined -->
<h3 class="fn" id="Style-enum"><a name="Style-enum"></a>enum QTextListFormat::<span class="name">Style</span></h3>
<p>This enum describes the symbols used to decorate list items:</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QTextListFormat::ListDisc</code></td><td class="topAlign tblval"><code>-1</code></td><td class="topAlign">a filled circle</td></tr>
<tr><td class="topAlign"><code>QTextListFormat::ListCircle</code></td><td class="topAlign tblval"><code>-2</code></td><td class="topAlign">an empty circle</td></tr>
<tr><td class="topAlign"><code>QTextListFormat::ListSquare</code></td><td class="topAlign tblval"><code>-3</code></td><td class="topAlign">a filled square</td></tr>
<tr><td class="topAlign"><code>QTextListFormat::ListDecimal</code></td><td class="topAlign tblval"><code>-4</code></td><td class="topAlign">decimal values in ascending order</td></tr>
<tr><td class="topAlign"><code>QTextListFormat::ListLowerAlpha</code></td><td class="topAlign tblval"><code>-5</code></td><td class="topAlign">lower case Latin characters in alphabetical order</td></tr>
<tr><td class="topAlign"><code>QTextListFormat::ListUpperAlpha</code></td><td class="topAlign tblval"><code>-6</code></td><td class="topAlign">upper case Latin characters in alphabetical order</td></tr>
<tr><td class="topAlign"><code>QTextListFormat::ListLowerRoman</code></td><td class="topAlign tblval"><code>-7</code></td><td class="topAlign">lower case roman numerals (supports up to 4999 items only)</td></tr>
<tr><td class="topAlign"><code>QTextListFormat::ListUpperRoman</code></td><td class="topAlign tblval"><code>-8</code></td><td class="topAlign">upper case roman numerals (supports up to 4999 items only)</td></tr>
</table></div>
<!-- @@@Style -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QTextListFormat[overload1]$$$QTextListFormat -->
<h3 class="fn" id="QTextListFormat"><a name="QTextListFormat"></a>QTextListFormat::<span class="name">QTextListFormat</span>()</h3>
<p>Constructs a new list format object.</p>
<!-- @@@QTextListFormat -->
<!-- $$$indent[overload1]$$$indent -->
<h3 class="fn" id="indent"><a name="indent"></a><span class="type">int</span> QTextListFormat::<span class="name">indent</span>() const</h3>
<p>Returns the list format's indentation. The indentation is multiplied by the <a href="qtextdocument.html#indentWidth-prop">QTextDocument::indentWidth</a> property to get the effective indent in pixels.</p>
<p><b>See also </b><a href="qtextlistformat.html#setIndent">setIndent</a>().</p>
<!-- @@@indent -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QTextListFormat::<span class="name">isValid</span>() const</h3>
<p>Returns <code>true</code> if this list format is valid; otherwise returns <code>false</code>.</p>
<!-- @@@isValid -->
<!-- $$$numberPrefix[overload1]$$$numberPrefix -->
<h3 class="fn" id="numberPrefix"><a name="numberPrefix"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QTextListFormat::<span class="name">numberPrefix</span>() const</h3>
<p>Returns the list format's number prefix.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qtextlistformat.html#setNumberPrefix">setNumberPrefix</a>().</p>
<!-- @@@numberPrefix -->
<!-- $$$numberSuffix[overload1]$$$numberSuffix -->
<h3 class="fn" id="numberSuffix"><a name="numberSuffix"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QTextListFormat::<span class="name">numberSuffix</span>() const</h3>
<p>Returns the list format's number suffix.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qtextlistformat.html#setNumberSuffix">setNumberSuffix</a>().</p>
<!-- @@@numberSuffix -->
<!-- $$$setIndent[overload1]$$$setIndentint -->
<h3 class="fn" id="setIndent"><a name="setIndent"></a><span class="type">void</span> QTextListFormat::<span class="name">setIndent</span>(<span class="type">int</span> <i>indentation</i>)</h3>
<p>Sets the list format's <i>indentation</i>. The indentation is multiplied by the <a href="qtextdocument.html#indentWidth-prop">QTextDocument::indentWidth</a> property to get the effective indent in pixels.</p>
<p><b>See also </b><a href="qtextlistformat.html#indent">indent</a>().</p>
<!-- @@@setIndent -->
<!-- $$$setNumberPrefix[overload1]$$$setNumberPrefixconstQString& -->
<h3 class="fn" id="setNumberPrefix"><a name="setNumberPrefix"></a><span class="type">void</span> QTextListFormat::<span class="name">setNumberPrefix</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>numberPrefix</i>)</h3>
<p>Sets the list format's number prefix to the string specified by <i>numberPrefix</i>. This can be used with all sorted list types. It does not have any effect on unsorted list types.</p>
<p>The default prefix is an empty string.</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qtextlistformat.html#numberPrefix">numberPrefix</a>().</p>
<!-- @@@setNumberPrefix -->
<!-- $$$setNumberSuffix[overload1]$$$setNumberSuffixconstQString& -->
<h3 class="fn" id="setNumberSuffix"><a name="setNumberSuffix"></a><span class="type">void</span> QTextListFormat::<span class="name">setNumberSuffix</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>numberSuffix</i>)</h3>
<p>Sets the list format's number suffix to the string specified by <i>numberSuffix</i>. This can be used with all sorted list types. It does not have any effect on unsorted list types.</p>
<p>The default suffix is &quot;.&quot;&#x2e;</p>
<p>This function was introduced in Qt 4.8.</p>
<p><b>See also </b><a href="qtextlistformat.html#numberSuffix">numberSuffix</a>().</p>
<!-- @@@setNumberSuffix -->
<!-- $$$setStyle[overload1]$$$setStyleQTextListFormat::Style -->
<h3 class="fn" id="setStyle"><a name="setStyle"></a><span class="type">void</span> QTextListFormat::<span class="name">setStyle</span>(<span class="type"><a href="qtextlistformat.html#Style-enum">QTextListFormat::Style</a></span> <i>style</i>)</h3>
<p>Sets the list format's <i>style</i>.</p>
<p><b>See also </b><a href="qtextlistformat.html#style">style</a>() and <a href="qtextlistformat.html#Style-enum">Style</a>.</p>
<!-- @@@setStyle -->
<!-- $$$style[overload1]$$$style -->
<h3 class="fn" id="style"><a name="style"></a><span class="type"><a href="qtextlistformat.html#Style-enum">QTextListFormat::Style</a></span> QTextListFormat::<span class="name">style</span>() const</h3>
<p>Returns the list format's style.</p>
<p><b>See also </b><a href="qtextlistformat.html#setStyle">setStyle</a>() and <a href="qtextlistformat.html#Style-enum">Style</a>.</p>
<!-- @@@style -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
